home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / kcl / akcl / akcl1615.lha / mp / mp_dblremsl3.c < prev    next >
C/C++ Source or Header  |  1991-05-16  |  497b  |  26 lines

  1. #include "include.h"
  2. #include "genpari.h"
  3. #include "arith.h"
  4.  
  5. int dblremsl3(x,y,z)
  6.      int x,y,z;
  7. { unsigned long h;
  8.   unsigned long w;
  9.   if (x>= 0 && y>= 0 && z>0)
  10.      {w = mulul(x,y,h);
  11.       divul(x,z,h);
  12.       return h;}
  13.   else
  14.     { long save = avma;
  15.       GEN yy = stoi(y);
  16.       GEN xx = stoi(x);
  17.       GEN ans = mulss(xx,yy);
  18.       ans = dvmdii(ans,stoi(z),-1);
  19.       avma = save;
  20.       if (signe(ans) > 0) return ans[2];
  21.       if (signe(ans) < 0) return -ans[2];
  22.       return 0;}
  23. }
  24.   
  25.  
  26.